<template>
  <div class="item ignore">
    <div class="itemLeft">{{ data.num }}.</div>
    <div class="itemRight">
      <p>
        <del v-if="data.del">{{ data.text }}</del>
        <span v-else>{{ data.text }}</span>
      </p>
      <div class="icon">
        <!-- 本图标记的-->
        <template v-if="type == 'detail'">
          <div class="user" v-if="data.user">
            <i class="el-icon-eleme"></i>
          </div>
          <div class="hoverChange view">
            <i class="el-icon-view"></i>
          </div>
          <div class="line hoverChange"></div>
          <div class="hoverChange">
            <i class="el-icon-delete"></i>
          </div>
          <div class="hoverChange" v-if="data.del">
            <i class="el-icon-back"></i>
          </div>
        </template>

        <!-- 全部标记的 -->
        <template v-if="type == 'all'">
          <div class="hoverChange">
            <i class="el-icon-plus"></i>
          </div>
        </template>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    data: {
      type: Object,
      default: () => {
        return {};
      },
    },
    type: {
      type: String,
      default: "detail", //detail 本图标记 all 全部标记
    },
  },

  data() {
    return {};
  },
};
</script>

<style lang="less" scoped>
.item {
  width: 100%;
  height: 32px;
  line-height: 32px;
  border-radius: 2px 2px 2px 2px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  color: #1d2129;
  font-size: 14px;
  padding: 8px 6px;
  box-sizing: border-box;
  &:hover {
    background: #f3f5f9;
  }
  .itemLeft {
    margin-right: 2px;
  }
}
.item:hover {
  .itemRight .icon > div {
    display: flex !important;
  }
  .itemRight .user {
    display: none;
  }
}
.itemRight {
  display: flex;
  flex: 1;
  min-width: 0;
  p {
    flex: 1;
    min-width: 0;
    text-align: left;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .icon {
    display: flex;
    align-items: center;
    & > div:not(.line) {
      width: 20px;
      height: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      &:hover {
        background-color: #e5e6eb;
      }
    }
    & > div {
      cursor: pointer;
    }
  }
  .icon div.hoverChange {
    display: none;
  }

  .view {
    display: flex;
    align-items: center;
  }
  .line {
    display: block;
    width: 1px;
    height: 14px;
    background-color: #dce1e8;
  }
}
</style>
